﻿// See https://aka.ms/new-console-template for more information
using Decorator;

Console.WriteLine("Hello, World!");

ConcreteComponent one=new ConcreteComponent();
ConcreteDecoratorA two = new ConcreteDecoratorA();
ConcreteDecoratorB three = new ConcreteDecoratorB();

// 用 ConcreteDecoratorA 来装饰 ConcreteComponent
two.SetComponent(one);
// 再用 ConcreteDecoratorB 来装饰 ConcreteDecoratorA
three.SetComponent(two);
// 最终执行 ConcreteDecoratorB 的Operation()方法
three.Operation();